define(['./CaseItem'], function(CaseItem) {
	return Backbone.View.extend({  
	  className: '',
	  template: _.template($('#tpl-case-item').html()),  
	  events: {  
	    'click [data-type="praise"]': 'praise'
	  },  

	  initialize: function() {  
		this.model.bind('change:zan', this.updateZan, this);
	    if (this.model.view) this.model.view.remove();  
	    this.model.view = this;  
	  },  

	  // 渲染
	  render: function() {  
	    this.$el.html(this.template(this.model.toJSON()));
	    return this;  
	  },
  
	  updateZan: function() {
		  var zan = this.model.get('zan');
		  this.$('[data-type="showPraise"]').text(zan);
	  },
  
	  praise: function() {
		  var zan = this.model.get('zan');
		  zan ++;
		  this.model.set({zan: zan});
	  }
	});  
}); 